package com.yangrd.airship.generator.support.impl;

import com.yangrd.airship.generator.support.PageGeneratorWriter;
import com.yangrd.airship.generator.support.utils.ObjMapper;
import lombok.RequiredArgsConstructor;

import java.io.Writer;
import java.util.List;

/**
 * @author yangrd
 * @date 2021/11/8
 */
@RequiredArgsConstructor
public class CompositePageGeneratorWriter implements PageGeneratorWriter {

    private final List<PageGeneratorWriter> delegates;

    @Override
    public List<Writer> listWriter(TableGeneratorWriterContext context) {
        return ObjMapper.flatMapList(delegates, d->d.listWriter(context));
    }
}
